:art: Return point info for screen

huangqimin001 3 years ago
parent
commit
cba7cfb0ad
1 changed files with 8 additions and 3 deletions
  1. 8 3
      api/screen_views.py

+ 8 - 3
api/screen_views.py

@@ -7,6 +7,8 @@ from django.conf import settings
7 7
 from django_logit import logit
8 8
 from django_response import response
9 9
 
10
+from equipment.models import IsolationPointInfo
11
+from utils.error.errno_utils import IsolationPointStatusCode
10 12
 from utils.redis.rpoint import get_point_info, set_point_info
11 13
 
12 14
 
@@ -36,6 +38,9 @@ def screen_info(request):
36 38
 
37 39
     point_id = get_point_info(uuid)
38 40
 
39
-    return response(data={
40
-        'point_id': point_id,
41
-    })
41
+    try:
42
+        point = IsolationPointInfo.objects.get(point_id=point_id, status=True)
43
+    except IsolationPointInfo.DoesNotExist:
44
+        return response(IsolationPointStatusCode.ISOLATIONPOINT_NOT_FOUND)
45
+
46
+    return response(data=point.data)